/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CadastroNotaFiscal2.java
 *
 * Created on 05/04/2011, 03:17:11
 */
package editar;

import Classe.BD;
import Classe.ClientePJ;
import Classe.Marca;
import Classe.Modelo;
import Classe.Orcamento;
import Classe.Peca;
import Classe.PecaHasOrcamento;
import Classe.Validacao;
import Classe.Veiculo;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import localizarInserir.LocalizarPecaInserir;
import localizarInserir.VeiculoOrcamento;

/**
 *
 * @author gladson
 */
public class EditarOrcamentoJuridica extends Validacao {

    int veiculoincluso = 0;

    /** Creates new form CadastroNotaFiscal2 */
    public EditarOrcamentoJuridica() {
        initComponents();
        this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    }
    int idCli;
    int idOrcamento;
    Double precoTotalPeca;
    Double valorTotNota;
    Orcamento orc = new Orcamento();
    Veiculo veiculo = new Veiculo();
    Marca marca = new Marca();
    Modelo modelo = new Modelo();

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        pnlCadastroNotaFiscal = new javax.swing.JPanel();
        jTabbedPaneNF = new javax.swing.JTabbedPane();
        pnlDestinatarioRemetente = new javax.swing.JPanel();
        pnlDestinatarioRemetenteNotaFiscal = new javax.swing.JPanel();
        rdPessoaFisicaNotaFiscal = new javax.swing.JRadioButton();
        rdPessoaJuridicaNotaFiscal = new javax.swing.JRadioButton();
        lblNomeRazaoNotaFiscal = new javax.swing.JLabel();
        lblCnpjCpfNotaFiscal = new javax.swing.JLabel();
        sTxtNomeCliente = new javax.swing.JTextField();
        sTxtcpjCliente = new javax.swing.JFormattedTextField();
        lblTelefoneFaxNotaFiscal = new javax.swing.JLabel();
        sTxtTelefoneCliente = new javax.swing.JTextField();
        txtCelularCliente = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        pnlEnderecoNotaFiscal = new javax.swing.JPanel();
        lblRuaAvenidaNotaFiscal = new javax.swing.JLabel();
        iTxtNumeroCliente = new javax.swing.JTextField();
        lblNumeroNotaFiscal = new javax.swing.JLabel();
        lblBairroNotaFiscal = new javax.swing.JLabel();
        lblCidadeNotaFiscal = new javax.swing.JLabel();
        lblUfNotaFiscal = new javax.swing.JLabel();
        lblApSalaNotaFiscal = new javax.swing.JLabel();
        stxtApSalaCliente = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        stxtCEPCliente = new javax.swing.JTextField();
        TxtComplCliente = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        cbUfCliente = new javax.swing.JTextField();
        cbCidadeCliente = new javax.swing.JTextField();
        cbBairroCliente = new javax.swing.JTextField();
        txtEndCliente = new javax.swing.JTextField();
        jpnVeiculoDestinatarioPeca = new javax.swing.JPanel();
        btLocalizarVeiculoDestinatarioPeca = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        txtveiculoCliente = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        txtCorVeicCliente = new javax.swing.JTextField();
        txtPlacaVeiCliente = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        txtAnoVeiCliente = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        txtMarcaVeiCliente = new javax.swing.JTextField();
        pnlPecaNotaFilcal = new javax.swing.JPanel();
        pnlProdutoPeca = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tabelaPecas = new javax.swing.JTable();
        btIncluirPeca = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        txtCodPeca = new javax.swing.JTextField();
        btExcluirPeca = new javax.swing.JButton();
        btLocPecaNF = new javax.swing.JButton();
        cbUniNF = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        txtQuantNF = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        txtValorUnitNF = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        pnlServNotaFilcal = new javax.swing.JPanel();
        pnlInternoServiçoNota = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        sTxtServicoNotaFiscal = new javax.swing.JTextArea();
        lblValorServicoNotaFiscal = new javax.swing.JLabel();
        txtValorServicoNotaFiscal = new javax.swing.JTextField();
        pnlObservacaoNotaFiscal1 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        stxtobsOrcamento = new javax.swing.JTextArea();
        jButton3 = new javax.swing.JButton();
        btSairNotaFiscal = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));

        pnlCadastroNotaFiscal.setBackground(new java.awt.Color(255, 255, 255));
        pnlCadastroNotaFiscal.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Editar Orçamento", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("PMingLiU", 1, 36))); // NOI18N
        pnlCadastroNotaFiscal.setPreferredSize(new java.awt.Dimension(800, 600));

        pnlDestinatarioRemetente.setBackground(new java.awt.Color(255, 255, 255));

        pnlDestinatarioRemetenteNotaFiscal.setBackground(new java.awt.Color(255, 255, 255));
        pnlDestinatarioRemetenteNotaFiscal.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Destinatário/Remetente", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N

        buttonGroup1.add(rdPessoaFisicaNotaFiscal);
        rdPessoaFisicaNotaFiscal.setText("Pessoa Fisca");

        buttonGroup1.add(rdPessoaJuridicaNotaFiscal);
        rdPessoaJuridicaNotaFiscal.setText("Pessoa Jurídica");

        lblNomeRazaoNotaFiscal.setFont(new java.awt.Font("Arial", 1, 11));
        lblNomeRazaoNotaFiscal.setText("Nome");

        lblCnpjCpfNotaFiscal.setFont(new java.awt.Font("Arial", 1, 11));
        lblCnpjCpfNotaFiscal.setText("CPF");

        sTxtNomeCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        sTxtcpjCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        lblTelefoneFaxNotaFiscal.setFont(new java.awt.Font("Arial", 1, 11));
        lblTelefoneFaxNotaFiscal.setText("Insc.Estadual");

        sTxtTelefoneCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        txtCelularCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel1.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel1.setText("Telefone");

        javax.swing.GroupLayout pnlDestinatarioRemetenteNotaFiscalLayout = new javax.swing.GroupLayout(pnlDestinatarioRemetenteNotaFiscal);
        pnlDestinatarioRemetenteNotaFiscal.setLayout(pnlDestinatarioRemetenteNotaFiscalLayout);
        pnlDestinatarioRemetenteNotaFiscalLayout.setHorizontalGroup(
            pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createSequentialGroup()
                        .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblNomeRazaoNotaFiscal)
                            .addComponent(sTxtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(sTxtcpjCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblCnpjCpfNotaFiscal))
                        .addGap(18, 18, 18)
                        .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(sTxtTelefoneCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblTelefoneFaxNotaFiscal))
                        .addGap(18, 18, 18)
                        .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(txtCelularCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)))
                    .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createSequentialGroup()
                        .addComponent(rdPessoaFisicaNotaFiscal)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(rdPessoaJuridicaNotaFiscal)))
                .addContainerGap())
        );
        pnlDestinatarioRemetenteNotaFiscalLayout.setVerticalGroup(
            pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createSequentialGroup()
                .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createSequentialGroup()
                        .addComponent(lblTelefoneFaxNotaFiscal)
                        .addGap(26, 26, 26))
                    .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createSequentialGroup()
                        .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lblCnpjCpfNotaFiscal)
                            .addComponent(jLabel1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(sTxtcpjCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(sTxtTelefoneCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtCelularCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createSequentialGroup()
                        .addGroup(pnlDestinatarioRemetenteNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(rdPessoaFisicaNotaFiscal)
                            .addComponent(rdPessoaJuridicaNotaFiscal))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lblNomeRazaoNotaFiscal)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(sTxtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pnlEnderecoNotaFiscal.setBackground(new java.awt.Color(255, 255, 255));
        pnlEnderecoNotaFiscal.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Endereço", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N

        lblRuaAvenidaNotaFiscal.setFont(new java.awt.Font("Arial", 1, 11));
        lblRuaAvenidaNotaFiscal.setText("Rua/Av.");

        iTxtNumeroCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        lblNumeroNotaFiscal.setFont(new java.awt.Font("Arial", 1, 11));
        lblNumeroNotaFiscal.setText("Nº.");

        lblBairroNotaFiscal.setFont(new java.awt.Font("Arial", 1, 11));
        lblBairroNotaFiscal.setText("Bairro");

        lblCidadeNotaFiscal.setFont(new java.awt.Font("Arial", 1, 11));
        lblCidadeNotaFiscal.setText("Cidade");

        lblUfNotaFiscal.setFont(new java.awt.Font("Arial", 1, 11));
        lblUfNotaFiscal.setText("UF");

        lblApSalaNotaFiscal.setFont(new java.awt.Font("Arial", 1, 11));
        lblApSalaNotaFiscal.setText("Ap/Sala");

        stxtApSalaCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel2.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel2.setText("CEP");

        stxtCEPCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        TxtComplCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel3.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel3.setText("Complemento");

        cbUfCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        cbCidadeCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        cbBairroCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        txtEndCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        javax.swing.GroupLayout pnlEnderecoNotaFiscalLayout = new javax.swing.GroupLayout(pnlEnderecoNotaFiscal);
        pnlEnderecoNotaFiscal.setLayout(pnlEnderecoNotaFiscalLayout);
        pnlEnderecoNotaFiscalLayout.setHorizontalGroup(
            pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                        .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblUfNotaFiscal)
                            .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(cbUfCliente, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lblRuaAvenidaNotaFiscal, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGap(18, 18, 18)
                        .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbCidadeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblCidadeNotaFiscal))
                        .addGap(28, 28, 28)
                        .addComponent(cbBairroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                        .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                                .addComponent(lblBairroNotaFiscal)
                                .addGap(197, 197, 197))
                            .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                                .addComponent(txtEndCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3)
                                    .addComponent(TxtComplCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)))
                        .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblNumeroNotaFiscal)
                            .addComponent(iTxtNumeroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(18, 18, 18)
                .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(lblApSalaNotaFiscal)
                    .addComponent(stxtApSalaCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)
                    .addComponent(jLabel2)
                    .addComponent(stxtCEPCliente))
                .addContainerGap(13, Short.MAX_VALUE))
        );
        pnlEnderecoNotaFiscalLayout.setVerticalGroup(
            pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                            .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                                    .addComponent(lblBairroNotaFiscal)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(cbBairroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                                    .addComponent(lblUfNotaFiscal)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(cbUfCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                                    .addComponent(lblCidadeNotaFiscal)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(cbCidadeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(lblRuaAvenidaNotaFiscal)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(txtEndCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                            .addComponent(jLabel2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(stxtCEPCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lblApSalaNotaFiscal)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(stxtApSalaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(pnlEnderecoNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(TxtComplCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addGap(26, 26, 26)))
                        .addGroup(pnlEnderecoNotaFiscalLayout.createSequentialGroup()
                            .addComponent(lblNumeroNotaFiscal)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(iTxtNumeroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        jpnVeiculoDestinatarioPeca.setBackground(new java.awt.Color(255, 255, 255));
        jpnVeiculoDestinatarioPeca.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Veículo", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N

        btLocalizarVeiculoDestinatarioPeca.setText("Incluir Veículo");
        btLocalizarVeiculoDestinatarioPeca.setToolTipText("Incluir Veículo");
        btLocalizarVeiculoDestinatarioPeca.setBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
        btLocalizarVeiculoDestinatarioPeca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btLocalizarVeiculoDestinatarioPecaActionPerformed(evt);
            }
        });

        jLabel8.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel8.setText("Veículo");

        txtveiculoCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel9.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel9.setText("Cor");

        txtCorVeicCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        txtPlacaVeiCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel10.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel10.setText("Placa");

        txtAnoVeiCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel11.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel11.setText("Ano");

        jLabel12.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel12.setText("Marca");

        txtMarcaVeiCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        javax.swing.GroupLayout jpnVeiculoDestinatarioPecaLayout = new javax.swing.GroupLayout(jpnVeiculoDestinatarioPeca);
        jpnVeiculoDestinatarioPeca.setLayout(jpnVeiculoDestinatarioPecaLayout);
        jpnVeiculoDestinatarioPecaLayout.setHorizontalGroup(
            jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnVeiculoDestinatarioPecaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpnVeiculoDestinatarioPecaLayout.createSequentialGroup()
                        .addGroup(jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(txtveiculoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9)
                            .addComponent(txtCorVeicCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtPlacaVeiCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10))
                        .addGap(18, 18, 18)
                        .addGroup(jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtAnoVeiCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11))
                        .addGap(18, 18, 18)
                        .addGroup(jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtMarcaVeiCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
                            .addComponent(jLabel12)))
                    .addComponent(btLocalizarVeiculoDestinatarioPeca))
                .addContainerGap())
        );
        jpnVeiculoDestinatarioPecaLayout.setVerticalGroup(
            jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpnVeiculoDestinatarioPecaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btLocalizarVeiculoDestinatarioPeca)
                .addGap(18, 18, 18)
                .addGroup(jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpnVeiculoDestinatarioPecaLayout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtveiculoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpnVeiculoDestinatarioPecaLayout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtCorVeicCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpnVeiculoDestinatarioPecaLayout.createSequentialGroup()
                        .addGroup(jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11)
                            .addComponent(jLabel12))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpnVeiculoDestinatarioPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtPlacaVeiCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtAnoVeiCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtMarcaVeiCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        javax.swing.GroupLayout pnlDestinatarioRemetenteLayout = new javax.swing.GroupLayout(pnlDestinatarioRemetente);
        pnlDestinatarioRemetente.setLayout(pnlDestinatarioRemetenteLayout);
        pnlDestinatarioRemetenteLayout.setHorizontalGroup(
            pnlDestinatarioRemetenteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDestinatarioRemetenteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDestinatarioRemetenteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jpnVeiculoDestinatarioPeca, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlDestinatarioRemetenteNotaFiscal, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlEnderecoNotaFiscal, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlDestinatarioRemetenteLayout.setVerticalGroup(
            pnlDestinatarioRemetenteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlDestinatarioRemetenteLayout.createSequentialGroup()
                .addContainerGap(35, Short.MAX_VALUE)
                .addComponent(pnlDestinatarioRemetenteNotaFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(pnlEnderecoNotaFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jpnVeiculoDestinatarioPeca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jTabbedPaneNF.addTab("Destinatário/Remetente", pnlDestinatarioRemetente);

        pnlPecaNotaFilcal.setBackground(new java.awt.Color(255, 255, 255));

        pnlProdutoPeca.setBackground(new java.awt.Color(255, 255, 255));
        pnlProdutoPeca.setBorder(javax.swing.BorderFactory.createTitledBorder("Produto(s)"));
        pnlProdutoPeca.setPreferredSize(new java.awt.Dimension(718, 450));

        tabelaPecas.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Código", "Descrição dos Produtos", "Unid.", "Quant.", "valor unit", "Valor Total"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Double.class, java.lang.Double.class, java.lang.Double.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(tabelaPecas);
        tabelaPecas.getColumnModel().getColumn(0).setPreferredWidth(20);
        tabelaPecas.getColumnModel().getColumn(0).setHeaderValue("Código");
        tabelaPecas.getColumnModel().getColumn(1).setPreferredWidth(262);
        tabelaPecas.getColumnModel().getColumn(1).setHeaderValue("Descrição dos Produtos");
        tabelaPecas.getColumnModel().getColumn(2).setPreferredWidth(3);
        tabelaPecas.getColumnModel().getColumn(2).setHeaderValue("Unid.");
        tabelaPecas.getColumnModel().getColumn(3).setPreferredWidth(20);
        tabelaPecas.getColumnModel().getColumn(3).setHeaderValue("Quant.");
        tabelaPecas.getColumnModel().getColumn(4).setPreferredWidth(35);
        tabelaPecas.getColumnModel().getColumn(4).setHeaderValue("valor unit");
        tabelaPecas.getColumnModel().getColumn(5).setPreferredWidth(35);
        tabelaPecas.getColumnModel().getColumn(5).setHeaderValue("Valor Total");

        btIncluirPeca.setFont(new java.awt.Font("Arial", 0, 12));
        btIncluirPeca.setText("Incluir");
        btIncluirPeca.setToolTipText("Incluir Peça");
        btIncluirPeca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btIncluirPecaActionPerformed(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel4.setText("Cód. Peça");

        txtCodPeca.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        btExcluirPeca.setFont(new java.awt.Font("Arial", 0, 12));
        btExcluirPeca.setText("Excluir");
        btExcluirPeca.setToolTipText("Excluir Peça Selecionada");
        btExcluirPeca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btExcluirPecaActionPerformed(evt);
            }
        });

        btLocPecaNF.setText("Localizar Peça");
        btLocPecaNF.setToolTipText("Localizar Peça");
        btLocPecaNF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btLocPecaNFActionPerformed(evt);
            }
        });

        cbUniNF.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
            null,"CX","UNID.","PCTE","KG","GR"}));
cbUniNF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

jLabel5.setFont(new java.awt.Font("Arial", 1, 11));
jLabel5.setText("Unidade");

txtQuantNF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

jLabel6.setFont(new java.awt.Font("Arial", 1, 11));
jLabel6.setText("Quant.");

txtValorUnitNF.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

jLabel7.setFont(new java.awt.Font("Arial", 1, 11));
jLabel7.setText("Valor Unit.");

javax.swing.GroupLayout pnlProdutoPecaLayout = new javax.swing.GroupLayout(pnlProdutoPeca);
pnlProdutoPeca.setLayout(pnlProdutoPecaLayout);
pnlProdutoPecaLayout.setHorizontalGroup(
    pnlProdutoPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(pnlProdutoPecaLayout.createSequentialGroup()
        .addContainerGap()
        .addGroup(pnlProdutoPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 670, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGroup(pnlProdutoPecaLayout.createSequentialGroup()
                .addGroup(pnlProdutoPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtCodPeca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addGap(18, 18, 18)
                .addGroup(pnlProdutoPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbUniNF, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addGap(18, 18, 18)
                .addGroup(pnlProdutoPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtQuantNF, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(18, 18, 18)
                .addGroup(pnlProdutoPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addGroup(pnlProdutoPecaLayout.createSequentialGroup()
                        .addComponent(txtValorUnitNF, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btIncluirPeca)
                        .addGap(18, 18, 18)
                        .addComponent(btExcluirPeca)
                        .addGap(18, 18, 18)
                        .addComponent(btLocPecaNF)))))
        .addContainerGap(19, Short.MAX_VALUE))
    );

    pnlProdutoPecaLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cbUniNF, txtCodPeca, txtQuantNF, txtValorUnitNF});

    pnlProdutoPecaLayout.setVerticalGroup(
        pnlProdutoPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlProdutoPecaLayout.createSequentialGroup()
            .addContainerGap()
            .addGroup(pnlProdutoPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jLabel6)
                .addComponent(jLabel7)
                .addComponent(jLabel4)
                .addComponent(jLabel5))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(pnlProdutoPecaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(txtCodPeca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(cbUniNF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(txtQuantNF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(txtValorUnitNF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(btIncluirPeca)
                .addComponent(btExcluirPeca)
                .addComponent(btLocPecaNF))
            .addGap(18, 18, 18)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap())
    );

    javax.swing.GroupLayout pnlPecaNotaFilcalLayout = new javax.swing.GroupLayout(pnlPecaNotaFilcal);
    pnlPecaNotaFilcal.setLayout(pnlPecaNotaFilcalLayout);
    pnlPecaNotaFilcalLayout.setHorizontalGroup(
        pnlPecaNotaFilcalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(pnlPecaNotaFilcalLayout.createSequentialGroup()
            .addContainerGap()
            .addComponent(pnlProdutoPeca, javax.swing.GroupLayout.DEFAULT_SIZE, 711, Short.MAX_VALUE)
            .addContainerGap())
    );
    pnlPecaNotaFilcalLayout.setVerticalGroup(
        pnlPecaNotaFilcalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(pnlPecaNotaFilcalLayout.createSequentialGroup()
            .addContainerGap()
            .addComponent(pnlProdutoPeca, javax.swing.GroupLayout.PREFERRED_SIZE, 417, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(24, Short.MAX_VALUE))
    );

    jTabbedPaneNF.addTab("Peça", pnlPecaNotaFilcal);

    pnlServNotaFilcal.setBackground(new java.awt.Color(255, 255, 255));

    pnlInternoServiçoNota.setBackground(new java.awt.Color(255, 255, 255));
    pnlInternoServiçoNota.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Seviço(s)", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 11))); // NOI18N

    sTxtServicoNotaFiscal.setColumns(20);
    sTxtServicoNotaFiscal.setRows(5);
    sTxtServicoNotaFiscal.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
    jScrollPane3.setViewportView(sTxtServicoNotaFiscal);

    lblValorServicoNotaFiscal.setFont(new java.awt.Font("Arial", 1, 11));
    lblValorServicoNotaFiscal.setText("Valor Serviço");

    txtValorServicoNotaFiscal.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

    javax.swing.GroupLayout pnlInternoServiçoNotaLayout = new javax.swing.GroupLayout(pnlInternoServiçoNota);
    pnlInternoServiçoNota.setLayout(pnlInternoServiçoNotaLayout);
    pnlInternoServiçoNotaLayout.setHorizontalGroup(
        pnlInternoServiçoNotaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(pnlInternoServiçoNotaLayout.createSequentialGroup()
            .addContainerGap()
            .addGroup(pnlInternoServiçoNotaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 679, Short.MAX_VALUE)
                .addComponent(lblValorServicoNotaFiscal)
                .addComponent(txtValorServicoNotaFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addContainerGap())
    );
    pnlInternoServiçoNotaLayout.setVerticalGroup(
        pnlInternoServiçoNotaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlInternoServiçoNotaLayout.createSequentialGroup()
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
            .addComponent(lblValorServicoNotaFiscal)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(txtValorServicoNotaFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap())
    );

    pnlObservacaoNotaFiscal1.setBackground(new java.awt.Color(255, 255, 255));
    pnlObservacaoNotaFiscal1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Observação", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N

    stxtobsOrcamento.setColumns(20);
    stxtobsOrcamento.setRows(5);
    stxtobsOrcamento.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
    jScrollPane4.setViewportView(stxtobsOrcamento);

    javax.swing.GroupLayout pnlObservacaoNotaFiscal1Layout = new javax.swing.GroupLayout(pnlObservacaoNotaFiscal1);
    pnlObservacaoNotaFiscal1.setLayout(pnlObservacaoNotaFiscal1Layout);
    pnlObservacaoNotaFiscal1Layout.setHorizontalGroup(
        pnlObservacaoNotaFiscal1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(pnlObservacaoNotaFiscal1Layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 679, Short.MAX_VALUE)
            .addContainerGap())
    );
    pnlObservacaoNotaFiscal1Layout.setVerticalGroup(
        pnlObservacaoNotaFiscal1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(pnlObservacaoNotaFiscal1Layout.createSequentialGroup()
            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)
            .addContainerGap())
    );

    javax.swing.GroupLayout pnlServNotaFilcalLayout = new javax.swing.GroupLayout(pnlServNotaFilcal);
    pnlServNotaFilcal.setLayout(pnlServNotaFilcalLayout);
    pnlServNotaFilcalLayout.setHorizontalGroup(
        pnlServNotaFilcalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlServNotaFilcalLayout.createSequentialGroup()
            .addContainerGap()
            .addGroup(pnlServNotaFilcalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addComponent(pnlObservacaoNotaFiscal1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(pnlInternoServiçoNota, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addContainerGap())
    );
    pnlServNotaFilcalLayout.setVerticalGroup(
        pnlServNotaFilcalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(pnlServNotaFilcalLayout.createSequentialGroup()
            .addContainerGap()
            .addComponent(pnlInternoServiçoNota, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGap(18, 18, 18)
            .addComponent(pnlObservacaoNotaFiscal1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addContainerGap())
    );

    jTabbedPaneNF.addTab("Serviço", pnlServNotaFilcal);

    jButton3.setText("Salvar");
    jButton3.setToolTipText("Salvar");
    jButton3.setBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
    jButton3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton3ActionPerformed(evt);
        }
    });

    btSairNotaFiscal.setFont(new java.awt.Font("Arial", 0, 12));
    btSairNotaFiscal.setText("Sair");
    btSairNotaFiscal.setToolTipText("Sair");
    btSairNotaFiscal.setBorder(javax.swing.BorderFactory.createCompoundBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
    btSairNotaFiscal.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btSairNotaFiscalActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout pnlCadastroNotaFiscalLayout = new javax.swing.GroupLayout(pnlCadastroNotaFiscal);
    pnlCadastroNotaFiscal.setLayout(pnlCadastroNotaFiscalLayout);
    pnlCadastroNotaFiscalLayout.setHorizontalGroup(
        pnlCadastroNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(pnlCadastroNotaFiscalLayout.createSequentialGroup()
            .addContainerGap()
            .addGroup(pnlCadastroNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jTabbedPaneNF, javax.swing.GroupLayout.DEFAULT_SIZE, 736, Short.MAX_VALUE)
                .addGroup(pnlCadastroNotaFiscalLayout.createSequentialGroup()
                    .addComponent(jButton3)
                    .addGap(18, 18, 18)
                    .addComponent(btSairNotaFiscal)))
            .addContainerGap())
    );

    pnlCadastroNotaFiscalLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btSairNotaFiscal, jButton3});

    pnlCadastroNotaFiscalLayout.setVerticalGroup(
        pnlCadastroNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(pnlCadastroNotaFiscalLayout.createSequentialGroup()
            .addComponent(jTabbedPaneNF, javax.swing.GroupLayout.PREFERRED_SIZE, 480, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(18, 18, 18)
            .addGroup(pnlCadastroNotaFiscalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jButton3)
                .addComponent(btSairNotaFiscal))
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );

    pnlCadastroNotaFiscalLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btSairNotaFiscal, jButton3});

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel1Layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(pnlCadastroNotaFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, 768, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(42, Short.MAX_VALUE))
    );
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(jPanel1Layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(pnlCadastroNotaFiscal, javax.swing.GroupLayout.DEFAULT_SIZE, 578, Short.MAX_VALUE)
            .addContainerGap())
    );

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    );

    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((screenSize.width-808)/2, (screenSize.height-627)/2, 808, 627);
    }// </editor-fold>//GEN-END:initComponents
    private void btSairNotaFiscalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSairNotaFiscalActionPerformed
        this.dispose();
    }//GEN-LAST:event_btSairNotaFiscalActionPerformed

    private void btIncluirPecaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btIncluirPecaActionPerformed
        if (validarPeca()) {
            try {
                int codPeca = Integer.parseInt(txtCodPeca.getText().trim());
                String sql = "SELECT * FROM PECA WHERE ID_PECA=" + codPeca;

                BD banco = new BD();
                ResultSet res = banco.consultar(sql);

                DefaultTableModel model = (DefaultTableModel) tabelaPecas.getModel();

                String unidade = (String) cbUniNF.getSelectedItem();
                int quantidade = Integer.parseInt(txtQuantNF.getText().trim());
                Double preco = Double.parseDouble(txtValorUnitNF.getText().trim());
                precoTotalPeca = preco * quantidade;

                if (res.next()) {
                    Object[] linha = {
                        res.getInt("ID_PECA"),
                        res.getString("NOME_PECA"),
                        unidade,
                        quantidade,
                        preco,
                        precoTotalPeca
                    };

                    model.addRow(linha);
                }

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }//GEN-LAST:event_btIncluirPecaActionPerformed

    private void btLocPecaNFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLocPecaNFActionPerformed
        LocalizarPecaInserir locPecIns = new LocalizarPecaInserir();
        locPecIns.setVisible(true);
    }//GEN-LAST:event_btLocPecaNFActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        if (validar()) {

            try {

//////////////////////////////PEGANDO O VALOR TOTAL DOS PRODUTOS////////////////////////////////////////////////
                DefaultTableModel tableModel = (DefaultTableModel) tabelaPecas.getModel();
                int linhas = tableModel.getRowCount();//contando quantas colunas tem
                double totalNf = 0;
                int i = 0;
                if (linhas > 0) {
                    while (i < linhas) {
                        Double test1 = Double.parseDouble(tableModel.getValueAt(i, 5).toString());
                        totalNf = totalNf + test1;
                        i++;
                    }
                }
///////////////////////////////FIM DE PEGANDO O VALOR TOTAL DOS PRODUTOS////////////////////////////////////////
                ClientePJ cli = new ClientePJ();
                cli.setIdClientePJ(idCli);//id_cliente

                orc.setServicoOrcamento(sTxtServicoNotaFiscal.getText().trim().toUpperCase());//servico_nf
                double serv = 0;
                if (txtValorServicoNotaFiscal.getText().trim().length() > 0) {
                    serv = Double.parseDouble(txtValorServicoNotaFiscal.getText().trim());
                }
                orc.setValorServOrcamento(serv);//valor_serv_nf
                totalNf = totalNf + serv;
                orc.setValorTotOrcamento(totalNf);//valor_tot_nf
                orc.setObsOrcamento(stxtobsOrcamento.getText().trim().toUpperCase());
                if (veiculoincluso == 0) {
                    String sql = "UPDATE ORCAMENTO SET  OBS_ORCAMENTO=?      ,VALOR_TOT_ORCAMENTO=?      , ID_VEICULO=?           ,ID_CLIENTE_PJ=?        ,SERVICO_ORCAMENTO=?        ,VALOR_SERV_ORCAMENTO=?  WHERE ID_ORCAMENTO=?";
                    Object[] parametros = {orc.getObsOrcamento(), orc.getValorTotOrcamento(), null, cli.getIdClientePJ(), orc.getServicoOrcamento(), orc.getValorServOrcamento(), orc.getIdOrcamento()};
                    Object[] tipos = {String.class, Double.class, Integer.class, Integer.class, String.class, Double.class, Integer.class};

                    BD banco = new BD();

                    banco.executar(sql, parametros, tipos);
                    JOptionPane.showMessageDialog(rootPane, "Atualização realizada com sucesso");
                } else {
                    String sql = "UPDATE ORCAMENTO SET  OBS_ORCAMENTO=?      ,VALOR_TOT_ORCAMENTO=?      , ID_VEICULO=?           ,ID_CLIENTE_PJ=?        ,SERVICO_ORCAMENTO=?        ,VALOR_SERV_ORCAMENTO=?  WHERE ID_ORCAMENTO=?";
                    Object[] parametros = {orc.getObsOrcamento(), orc.getValorTotOrcamento(), veiculo.getIdVeiculo(), cli.getIdClientePJ(), orc.getServicoOrcamento(), orc.getValorServOrcamento(), orc.getIdOrcamento()};
                    Object[] tipos = {String.class, Double.class, Integer.class, Integer.class, String.class, Double.class, Integer.class};

                    BD banco = new BD();

                    banco.executar(sql, parametros, tipos);
                    JOptionPane.showMessageDialog(rootPane, "Atualização realizada com sucesso");
                }
            } catch (Exception ex) {
                Logger.getLogger(EditarOrcamentoJuridica.class.getName()).log(Level.SEVERE, null, ex);
            }
/////////////////////////////////FIM DE SALVANDO A NOTA//////////////////////////////////////////////////////////



            try {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                String del = "DELETE FROM PECA_HAS_ORCAMENTO WHERE ID_ORCAMENTO=?";
                BD banco2 = new BD();
                Object[] parametros2 = {orc.getIdOrcamento()};
                Object[] tipos2 = {Integer.class};
                banco2.executar(del, parametros2, tipos2);
//////////////////////////////////////////////////////////////////////////////////////////////////////////
                DefaultTableModel tableModel = (DefaultTableModel) tabelaPecas.getModel();
                int linhas = tableModel.getRowCount();//contando quantas colunas tem
                int i = 0;
                if (linhas > 0) {
                    while (i < linhas) {
                        PecaHasOrcamento OrcPc = new PecaHasOrcamento();

                        OrcPc.setValorUnitOrc(Double.parseDouble(tableModel.getValueAt(i, 4).toString()));
                        OrcPc.setValorTotOrc(Double.parseDouble(tableModel.getValueAt(i, 5).toString()));
                        OrcPc.setQuantOrc(Double.parseDouble(tableModel.getValueAt(i, 3).toString()));
                        OrcPc.setUnidadeOrc(tableModel.getValueAt(i, 2).toString().toUpperCase());

                        Peca Pc = new Peca();

                        Pc.setIdPeca(Integer.parseInt(tableModel.getValueAt(i, 0).toString().toUpperCase()));

                        String sql = "INSERT INTO PECA_HAS_ORCAMENTO (ID_PECA_ORCAMENTO   ,ID_PECA       ,ID_ORCAMENTO        ,VALOR_UNID_ORC         ,VALOR_TOT_ORC         ,QUANT_ORC          ,UNID_ORC            ) "
                                + "VALUES(SQ_PECA_HAS_ORCAMENTO.NEXTVAL,?             ,?                   ,?                      ,?                     ,?                  ,?                   )";
                        Object[] parametros = {Pc.getIdPeca(), orc.getIdOrcamento(), OrcPc.getValorUnitOrc(), OrcPc.getValorTotOrc(), OrcPc.getQuantOrc(), OrcPc.getUnidadeOrc()};
                        Object[] tipos = {Integer.class, Integer.class, Double.class, Double.class, Double.class, String.class};

                        BD banco = new BD();

                        banco.executar(sql, parametros, tipos);

                        i++;
                    }
                }
                /////////////////////////////////FIM DE PEGANDO A ULTIMA NOTA GERADA E SALVADO NA TABELA NOTA_HAS_PECA//////////
            } catch (Exception ex) {
                Logger.getLogger(EditarOrcamentoJuridica.class.getName()).log(Level.SEVERE, null, ex);
            }

        }
    }//GEN-LAST:event_jButton3ActionPerformed

    private void btExcluirPecaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirPecaActionPerformed
        ((DefaultTableModel) tabelaPecas.getModel()).removeRow(tabelaPecas.getSelectedRow());
    }//GEN-LAST:event_btExcluirPecaActionPerformed

    private void btLocalizarVeiculoDestinatarioPecaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLocalizarVeiculoDestinatarioPecaActionPerformed
        VeiculoOrcamento veic = new VeiculoOrcamento();
        veic.iniciar(this, idCli);
    }//GEN-LAST:event_btLocalizarVeiculoDestinatarioPecaActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new EditarOrcamentoJuridica().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField TxtComplCliente;
    private javax.swing.JButton btExcluirPeca;
    private javax.swing.JButton btIncluirPeca;
    private javax.swing.JButton btLocPecaNF;
    private javax.swing.JButton btLocalizarVeiculoDestinatarioPeca;
    private javax.swing.JButton btSairNotaFiscal;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JTextField cbBairroCliente;
    private javax.swing.JTextField cbCidadeCliente;
    private javax.swing.JTextField cbUfCliente;
    private javax.swing.JComboBox cbUniNF;
    private javax.swing.JTextField iTxtNumeroCliente;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPaneNF;
    private javax.swing.JPanel jpnVeiculoDestinatarioPeca;
    private javax.swing.JLabel lblApSalaNotaFiscal;
    private javax.swing.JLabel lblBairroNotaFiscal;
    private javax.swing.JLabel lblCidadeNotaFiscal;
    private javax.swing.JLabel lblCnpjCpfNotaFiscal;
    private javax.swing.JLabel lblNomeRazaoNotaFiscal;
    private javax.swing.JLabel lblNumeroNotaFiscal;
    private javax.swing.JLabel lblRuaAvenidaNotaFiscal;
    private javax.swing.JLabel lblTelefoneFaxNotaFiscal;
    private javax.swing.JLabel lblUfNotaFiscal;
    private javax.swing.JLabel lblValorServicoNotaFiscal;
    private javax.swing.JPanel pnlCadastroNotaFiscal;
    private javax.swing.JPanel pnlDestinatarioRemetente;
    private javax.swing.JPanel pnlDestinatarioRemetenteNotaFiscal;
    private javax.swing.JPanel pnlEnderecoNotaFiscal;
    private javax.swing.JPanel pnlInternoServiçoNota;
    private javax.swing.JPanel pnlObservacaoNotaFiscal1;
    private javax.swing.JPanel pnlPecaNotaFilcal;
    private javax.swing.JPanel pnlProdutoPeca;
    private javax.swing.JPanel pnlServNotaFilcal;
    private javax.swing.JRadioButton rdPessoaFisicaNotaFiscal;
    private javax.swing.JRadioButton rdPessoaJuridicaNotaFiscal;
    private javax.swing.JTextField sTxtNomeCliente;
    private javax.swing.JTextArea sTxtServicoNotaFiscal;
    private javax.swing.JTextField sTxtTelefoneCliente;
    private javax.swing.JFormattedTextField sTxtcpjCliente;
    private javax.swing.JTextField stxtApSalaCliente;
    private javax.swing.JTextField stxtCEPCliente;
    private javax.swing.JTextArea stxtobsOrcamento;
    private javax.swing.JTable tabelaPecas;
    private javax.swing.JTextField txtAnoVeiCliente;
    private javax.swing.JTextField txtCelularCliente;
    private javax.swing.JTextField txtCodPeca;
    private javax.swing.JTextField txtCorVeicCliente;
    private javax.swing.JTextField txtEndCliente;
    private javax.swing.JTextField txtMarcaVeiCliente;
    private javax.swing.JTextField txtPlacaVeiCliente;
    private javax.swing.JTextField txtQuantNF;
    private javax.swing.JTextField txtValorServicoNotaFiscal;
    private javax.swing.JTextField txtValorUnitNF;
    private javax.swing.JTextField txtveiculoCliente;
    // End of variables declaration//GEN-END:variables

    public void iniciar(int orca) {
        this.idOrcamento = orca;

        this.orc.setIdOrcamento(orca);
        txtveiculoCliente.setEnabled(false);
        txtCorVeicCliente.setEnabled(false);
        txtPlacaVeiCliente.setEnabled(false);
        txtAnoVeiCliente.setEnabled(false);
        txtMarcaVeiCliente.setEnabled(false);
        rdPessoaJuridicaNotaFiscal.setSelected(true);
        rdPessoaFisicaNotaFiscal.setEnabled(false);
        rdPessoaJuridicaNotaFiscal.setEnabled(false);
        sTxtNomeCliente.setEnabled(false);
        sTxtcpjCliente.setEnabled(false);
        sTxtTelefoneCliente.setEnabled(false);
        txtCelularCliente.setEnabled(false);
        cbUfCliente.setEnabled(false);
        cbCidadeCliente.setEnabled(false);
        cbBairroCliente.setEnabled(false);
        stxtCEPCliente.setEnabled(false);
        txtEndCliente.setEnabled(false);
        TxtComplCliente.setEnabled(false);
        iTxtNumeroCliente.setEnabled(false);
        stxtApSalaCliente.setEnabled(false);
        txtveiculoCliente.setEnabled(false);
        txtCorVeicCliente.setEnabled(false);
        txtPlacaVeiCliente.setEnabled(false);
        txtAnoVeiCliente.setEnabled(false);
        txtMarcaVeiCliente.setEnabled(false);


///////////////////////////////////////////////////////////////////////////////////////////////////////////
        try {
            String sql = "SELECT O.ID_ORCAMENTO,CLI.ID_CLIENTE_PJ,CLI.RAZAO_CLIENTE_PJ,CLI.CNPJ_CLIENTE_PJ,CLI.INSC_EST_CLIENTE_PJ,"
                    + "CLI.TEL_CLIENTE_PJ,EST.ID_UF,CID.NOME_CIDADE, BAI.NOME_BAIRRO,ENDE.CEP AS CEP_END,ENDE.NOME_ENDERECO,"
                    + "CLI.COMPL_CLIENTE_PJ,CLI.NUM_CLIENTE_PJ,CLI.SALA_CLIENTE_PJ,VEI.ID_VEICULO,MO.MODELO,VEI.COR_VEICULO,"
                    + "VEI.PLACA_VEICULO,VEI.ANO_VEICULO,MAR.MARCA,O.SERVICO_ORCAMENTO, O.VALOR_SERV_ORCAMENTO, O.OBS_ORCAMENTO "
                    + "FROM ORCAMENTO O "
                    + "INNER JOIN CLIENTE_PJ CLI ON O.ID_CLIENTE_PJ= CLI.ID_CLIENTE_PJ "
                    + "INNER JOIN ENDERECO ENDE ON CLI.ID_ENDERECO=ENDE.ID_ENDERECO "
                    + "INNER JOIN BAIRRO BAI ON BAI.ID_BAIRRO=ENDE.ID_BAIRRO "
                    + "INNER JOIN CIDADE CID ON BAI.ID_CIDADE=CID.ID_CIDADE "
                    + "INNER JOIN ESTADO EST ON EST.ID_UF=CID.ID_UF "
                    + "LEFT JOIN VEICULO VEI ON O.ID_VEICULO=VEI.ID_VEICULO "
                    + "LEFT JOIN MODELO MO ON VEI.ID_MODELO= MO.ID_MODELO "
                    + "LEFT JOIN MARCA MAR ON MAR.ID_MARCA=MO.ID_MARCA "
                    + "WHERE O.ID_ORCAMENTO=" + orca;

            BD bd = new BD();
            ResultSet rs = bd.consultar(sql);

            if (rs.next()) {
                idCli = rs.getInt("ID_CLIENTE_PJ");
                veiculo.setIdVeiculo(rs.getInt("ID_VEICULO"));
                sTxtNomeCliente.setText(rs.getString("RAZAO_CLIENTE_PJ"));
                sTxtcpjCliente.setText(rs.getString("CNPJ_CLIENTE_PJ"));
                sTxtTelefoneCliente.setText(rs.getString("INSC_EST_CLIENTE_PJ"));
                txtCelularCliente.setText(rs.getString("TEL_CLIENTE_PJ"));
                cbUfCliente.setText(rs.getString("ID_UF"));
                cbCidadeCliente.setText(rs.getString("NOME_CIDADE"));
                cbBairroCliente.setText(rs.getString("NOME_BAIRRO"));
                stxtCEPCliente.setText(rs.getString("CEP_END"));
                txtEndCliente.setText(rs.getString("NOME_ENDERECO"));
                TxtComplCliente.setText(rs.getString("COMPL_CLIENTE_PJ"));
                iTxtNumeroCliente.setText(rs.getString("NUM_CLIENTE_PJ"));
                stxtApSalaCliente.setText(rs.getString("SALA_CLIENTE_PJ"));
                txtveiculoCliente.setText(rs.getString("MODELO"));

                if (!txtveiculoCliente.getText().trim().equals("") && txtveiculoCliente.getText().trim() != null) {
                    veiculoincluso = 1;
                }
                txtCorVeicCliente.setText(rs.getString("COR_VEICULO"));
                txtPlacaVeiCliente.setText(rs.getString("PLACA_VEICULO"));
                txtAnoVeiCliente.setText(rs.getString("ANO_VEICULO"));
                txtMarcaVeiCliente.setText(rs.getString("MARCA"));
                sTxtServicoNotaFiscal.setText(rs.getString("SERVICO_ORCAMENTO"));
                txtValorServicoNotaFiscal.setText(rs.getString("VALOR_SERV_ORCAMENTO"));
                stxtobsOrcamento.setText(rs.getString("OBS_ORCAMENTO"));
            }


        } catch (ClassNotFoundException ex) {
            Logger.getLogger(EditarOrcamentoJuridica.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(EditarOrcamentoJuridica.class.getName()).log(Level.SEVERE, null, ex);
        }

        try {
            String sqlp = "SELECT PO.ID_PECA,PE.NOME_PECA,PO.UNID_ORC,PO.QUANT_ORC,PO.VALOR_UNID_ORC,PO.VALOR_TOT_ORC "
                    + "FROM PECA_HAS_ORCAMENTO PO INNER JOIN PECA PE ON PE.ID_PECA=PO.ID_PECA "
                    + "WHERE PO.ID_ORCAMENTO=" + idOrcamento;

            BD bd5 = new BD();
            ResultSet red;

            red = bd5.consultar(sqlp);
            DefaultTableModel model = (DefaultTableModel) tabelaPecas.getModel();

            while (red.next()) {
                Object[] linha = {
                    red.getInt("ID_PECA"),
                    red.getString("NOME_PECA"),
                    red.getString("UNID_ORC"),
                    red.getDouble("QUANT_ORC"),
                    red.getDouble("VALOR_UNID_ORC"),
                    red.getDouble("VALOR_TOT_ORC")
                };

                model.addRow(linha);

            }

        } catch (ClassNotFoundException ex) {
            Logger.getLogger(EditarOrcamentoJuridica.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(EditarOrcamentoJuridica.class.getName()).log(Level.SEVERE, null, ex);
        }

        this.setVisible(true);
    }

    public void preencherVeiculo(Veiculo v, Modelo m, Marca mar) {


        this.veiculo = v;
        this.marca = mar;
        this.modelo = m;

        txtveiculoCliente.setText(modelo.getModelo());
        txtCorVeicCliente.setText(veiculo.getCorVeiiculo());
        txtPlacaVeiCliente.setText(veiculo.getPlacaVeiculo());
        txtAnoVeiCliente.setText(veiculo.getAnoVeiculo());
        txtMarcaVeiCliente.setText(marca.getNomeMarca());
        veiculoincluso = 1;

    }

    public boolean validar() {
        boolean Resultado = true;

        DefaultTableModel tableModel = (DefaultTableModel) tabelaPecas.getModel();
        int linhas = tableModel.getRowCount();//contando quantas colunas tem

        if (validarObservacao(stxtobsOrcamento.getText().trim()) == false) {
            Resultado = false;
        } else if (validarServico(sTxtServicoNotaFiscal.getText().trim(), txtValorServicoNotaFiscal.getText().trim().length()) == false) {
            Resultado = false;

        } else if (validarValorServico(txtValorServicoNotaFiscal.getText().trim(), sTxtServicoNotaFiscal.getText().trim().length()) == false) {
            Resultado = false;
        } else if (linhas == 0 && txtValorServicoNotaFiscal.getText().trim().length() == 0) {
            Resultado = false;
            JOptionPane.showMessageDialog(rootPane, "Obrigatório o Preenchimento de uma Peça ou Serviço");
        }

        return Resultado;
    }

    public boolean validarPeca() {
        boolean Resultado = true;

        if (validarNumero(txtCodPeca.getText().trim()) == false) {
            Resultado = false;
        } else if (cbUniNF.getSelectedItem().equals("")) {
            JOptionPane.showMessageDialog(rootPane, "Seleção do campo Unidade Obrigatório!!");
            Resultado = false;
        } else if (validarQuant(txtQuantNF.getText().trim()) == false) {
            Resultado = false;
        } else if (validarValor(txtValorUnitNF.getText().trim()) == false) {
            Resultado = false;
        }

        return Resultado;
    }
}
